/**
 * 项目名称: LCR_142.cpp
 * 项目路径: study/DataStructure/LinkedList/LeetCode/剑指Offer
 * 编辑时间: 2024年06月28日20时15分17秒
 * 用   户: 轻尘
 */

#include <iostream>
#include "algorithm"
using namespace std;

struct ListNode {
    int val;
    ListNode *next;

    ListNode() : val(0), next(nullptr) {}

    ListNode(int x) : val(x), next(nullptr) {}

    ListNode(int x, ListNode *next) : val(x), next(next) {}
};

class Solution {
public:
    bool cmps(int x,int y){
        return x>y;
    }
    ListNode *trainningPlan(ListNode *l1, ListNode *l2) {
        if (!l1 && !l2)return nullptr;

        ListNode *head1 = l1;
        ListNode *head2 = l2;

        ListNode * result = nullptr;

        int pp[1010];
        int cnt = 0 ;
        while (head2){
            pp[cnt++]=head2->val;
            head2 = head2->next;
        }
        while (head1){
            pp[cnt++]=head1->val;
            head1 = head1->next;
        }
        sort(pp,pp+cnt);

        for(int i = 0;i<cnt;i++){
            ListNode * tmp = new ListNode;
            tmp->val = pp[i];
            if(!result)result = tmp;
            else{
                ListNode * p =result;
                while (p->next)p=p->next;
                p->next = tmp;
            }
        }
        return result;
    }
};


int main() {

    return 0;
}
